Vue.component('home-login', {
    data: function () {
      return {
        count: 0,
        i18n: {
          title: '管理系统',
          username: '邮箱/手机号/用户名',
          password: '请输入密码...',
          loginbtn: '登  录',
          rights: 'Copy Right© 2018-2020 江湖梦 All Rights Reserved'
        }
      }
    },
    template: ' \
      <div class="container-fluid"> \
        <div class="row lh-row"> \
        </div>\
        <div class="row lc-row">\
            <form class="form-horizontal col-sm-offset-5 col-md-offset-5" id="login_form">\
              <div class="col-sm-4 col-md-4"> \
                  <h1 class="form-title">{{ i18n.title }}</h1> \
                  <div class="form-group"> \
                      <div class="input-group"> \
                        <div class="input-group-addon"><i class="fa fa-user fa-lg"></i></div> \
                        <input class="form-control required" type="text" :placeholder="i18n.username" name="username" autofocus="autofocus" maxlength="20"/>  \
                      </div>\
                  </div> \
                  <div class="form-group"> \
                      <div class="input-group"> \
                        <div class="input-group-addon"><i class="fa fa-lock fa-lg"></i></div> \
                        <input id="login-password" class="form-control required" type="password" :placeholder="i18n.password" name="password" maxlength="8"/> \
                      </div>\
                  </div> \
                  <div class="form-group"> \
                      <input type="button" class="btn btn-success pull-right" :value="i18n.loginbtn" id="login-submit" /> \
                  </div> \
                  <div class="lf-row">{{ i18n.rights }}</div>\
              </div> \
            </form> \
        </div> \
      <div> \
    ',
    methods: {

    },
    mounted: function() {
        $('#login-submit').click(function() {
            localStorage.setItem('loginState', '1');
            router.push({ path: '/' });
        });
        $('#login-password').keydown(function(event) {
            if(event.keyCode == 13) {
                localStorage.setItem('loginState', '1');
                router.push({ path: '/' });
            }
        });
    }
});